package srv

import (
	redsyncredis "github.com/go-redsync/redsync/v4/redis"
	"github.com/go-redsync/redsync/v4/redis/goredis/v9"
	"mxshop/app/mxshop_srv/inventory/srv/internal/data/v1"
	"mxshop/app/mxshop_srv/inventory/srv/internal/service"
	"mxshop/gmicro/pkg/storage"
)

type serviceFactory struct {
	data data.DataFactory
	pool redsyncredis.Pool
}

func (sf *serviceFactory) Inventory() service.InventorySrv {
	return newInventory(sf)
}

func NewService(store data.DataFactory) service.ServiceFactory {
	rstore := storage.RedisCluster{}
	pool := goredis.NewPool(rstore.GetClient())
	return &serviceFactory{data: store, pool: pool}
}
